import "./assets/css/main.less";

import { createApp } from "vue";
import { createPinia } from "pinia";
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
import zhCn from "element-plus/es/locale/lang/zh-cn";
import L from "leaflet";
import "leaflet/dist/leaflet.css";
import Antd from "ant-design-vue";
import "ant-design-vue/dist/reset.css";
import "vant/lib/index.css";
import "@ansur/leaflet-pulse-icon";
import "@ansur/leaflet-pulse-icon/dist/L.Icon.Pulse.css";
import "leaflet-semicircle";
// leaflet-arc
import "leaflet-arc";

import { Swipe, SwipeItem, Popup, Checkbox, CheckboxGroup,Field, DatePicker  } from "vant";
import App from "./App.vue";
import router from "./router";
import scroll from "vue-seamless-scroll"; 
import 'vant/lib/index.css'

const app = createApp(App);

app.use(createPinia());
app.use(router);
app.use(ElementPlus, { locale: zhCn });
app.use(Antd);
app.use(Swipe);
app.use(SwipeItem);
app.use(Popup);
app.use(Checkbox);
app.use(CheckboxGroup);
app.use(scroll);
app.use(Field)
// app.use(Popup)
app.use(DatePicker)

app.mount("#app");

/**
 * 模拟C#的padleft
 * @param {any} totalWidth 字符总长度
 * @param {any} paddingChar 补全的字符
 */
String.prototype.PadLeft = function (totalWidth, paddingChar) {
  if (paddingChar !== null) {
    return this.PadHelper(totalWidth, paddingChar, false);
  } else {
    return this.PadHelper(totalWidth, " ", false);
  }
};
String.prototype.PadRight = function (totalWidth, paddingChar) {
  if (paddingChar !== null) {
    return this.PadHelper(totalWidth, paddingChar, true);
  } else {
    return this.PadHelper(totalWidth, " ", true);
  }
};
String.prototype.PadHelper = function (totalWidth, paddingChar, isRightPadded) {
  if (this.length < totalWidth) {
    let paddingString = new String();
    for (let i = 1; i <= totalWidth - this.length; i++) {
      paddingString += paddingChar;
    }
    if (isRightPadded) {
      return this + paddingString;
    } else {
      return paddingString + this;
    }
  } else {
    return this;
  }
};
